home *** CD-ROM | disk | FTP | other *** search
- #ifndef __STD_FSTREAM__
- #define __STD_FSTREAM__
- #pragma option push -b -a4 -Vx- -Ve- -w-inl -w-aus -w-sig
-
- /***************************************************************************
- *
- * fstream -- Declarations for the Standard Library file bufs and streams
- *
- * $Id: fstream,v 1.48 1996/09/24 19:01:05 smithey Exp $
- *
- ***************************************************************************
- *
- * (c) Copyright 1994, 1995 Rogue Wave Software, Inc.
- * ALL RIGHTS RESERVED *
- * The software and information contained herein are proprietary to, and
- * comprise valuable trade secrets of, Rogue Wave Software, Inc., which
- * intends to preserve as trade secrets such software and information.
- * This software is furnished pursuant to a written license agreement and
- * may be used, copied, transmitted, and stored only in accordance with
- * the terms of such license and with the inclusion of the above copyright
- * notice. This software and information or any other copies thereof may
- * not be provided or otherwise made available to any other person.
- *
- * Notwithstanding any other lease or license that may pertain to, or
- * accompany the delivery of, this computer software and information, the
- * rights of the Government regarding its use, reproduction and disclosure
- * are as set forth in Section 52.227-19 of the FARS Computer
- * Software-Restricted Rights clause.
- *
- * Use, duplication, or disclosure by the Government is subject to
- * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
- * Technical Data and Computer Software clause at DFARS 252.227-7013.
- * Contractor/Manufacturer is Rogue Wave Software, Inc.,
- * P.O. Box 2328, Corvallis, Oregon 97339.
- *
- * This computer software and information is distributed with "restricted
- * rights." Use, duplication or disclosure is subject to restrictions as
- * set forth in NASA FAR SUP 18-52.227-79 (April 1985) "Commercial
- * Computer Software-Restricted Rights (April 1985)." If the Clause at
- * 18-52.227-74 "Rights in Data General" is specified in the contract,
- * then the "Alternate III" clause applies.
- *
- **************************************************************************/
- #include <stdcomp.h>
-
- #include <istream>
- #include <ostream>
- #include <streambuf>
-
- #ifndef _RWSTD_NO_NEW_HEADER
- #include <cstdlib>
- #include <cfcntl>
- #else
- #include <stdlib.h>
- #include <fcntl.h>
- #endif
-
-
- #if defined (_MSC_VER) || defined (__TURBOC__)
- #include <io.h>
- #else
- #ifndef _RWSTD_NO_NEW_HEADER
- #include <cunistd>
- #else
- #include <unistd.h>
- #endif
-
- #endif
-
- #ifndef _RWSTD_NO_NAMESPACE
- namespace std {
- #endif
-
- extern int _RWSTDExport __rwOpenTable[32];
-
- template<class charT, class traits>
- class _RWSTDExportTemplate basic_filebuf : public basic_streambuf<charT, traits> {
-
- private:
-
- #ifdef HPPA_WA
- public:
- #endif
-
- typedef basic_ios<charT, traits> ios_type;
- typedef _TYPENAME traits::state_type state_t;
-
- public:
- typedef traits traits_type;
- typedef charT char_type;
- typedef _TYPENAME traits::int_type int_type;
- typedef _TYPENAME traits::pos_type pos_type;
- typedef _TYPENAME traits::off_type off_type;
-
- basic_filebuf();
- basic_filebuf(int fd);
-
- virtual ~basic_filebuf();
-
- bool is_open() const;
-
- basic_filebuf<charT, traits> *
- open(const char *s, ios_base::openmode, long protection = 0666 );
-
- basic_filebuf<charT, traits> *open(int fd);
-
- basic_filebuf<charT, traits> *close();
-
- protected:
-
- virtual int showmanyc();
- virtual int_type overflow(int_type c = traits::eof());
- virtual int_type pbackfail(int_type c = traits::eof());
- virtual int_type underflow();
-
- virtual basic_streambuf<charT,traits>*
- setbuf(char_type *s,streamsize n);
-
-
- virtual pos_type seekoff(off_type off,
- ios_base::seekdir way,
- ios_base::openmode which =
- ios_base::in | ios_base::out);
- virtual pos_type seekpos(pos_type sp,
- ios_base::openmode which =
- ios_base::in | ios_base::out);
-
- virtual int sync( );
-
- virtual streamsize xsputn(const char_type *s, streamsize n);
-
-
- private:
-
- int file_;
- bool read_buff_;
- bool write_buff_;
- streamsize last_numb_read_;
- streamsize __rwBufferSize;
-
- streamsize absolute_pos;
-
- state_t *state_beg;
- state_t *state_end;
-
- char_type *data_;
- };
-
-
-
- template<class charT, class traits>
- class _RWSTDExportTemplate basic_ifstream : public basic_istream<charT, traits> {
-
- public:
-
- typedef basic_ios<charT, traits> ios_type;
-
- typedef traits traits_type;
- typedef charT char_type;
- typedef _TYPENAME traits::int_type int_type;
- typedef _TYPENAME traits::pos_type pos_type;
- typedef _TYPENAME traits::off_type off_type;
-
- public:
-
- basic_ifstream();
-
- _EXPLICIT basic_ifstream(const char *s,
- ios_base::openmode mode = ios_base::in,
- long protection = 0666 );
-
- _EXPLICIT basic_ifstream(int fd);
-
- basic_ifstream(int fd, char_type *buf, int len);
-
- virtual ~basic_ifstream();
-
- basic_filebuf<charT, traits> *rdbuf() const;
-
- bool is_open();
-
- void open(const char *s, ios_base::openmode mode = ios_base::in,
- long protection = 0666 );
-
- void close();
-
- protected:
-
- private:
-
- basic_filebuf<charT, traits> fb_;
-
-
- };
-
-
- template<class charT, class traits>
- class _RWSTDExportTemplate basic_ofstream : public basic_ostream<charT, traits> {
-
- public:
-
- typedef basic_ios<charT, traits> ios_type;
-
- typedef traits traits_type;
- typedef charT char_type;
- typedef _TYPENAME traits::int_type int_type;
- typedef _TYPENAME traits::pos_type pos_type;
- typedef _TYPENAME traits::off_type off_type;
-
- public:
-
- basic_ofstream();
-
- _EXPLICIT basic_ofstream(const char *s, ios_base::openmode mode =
- ios_base::out,
- long protection = 0666 );
-
- _EXPLICIT basic_ofstream(int fd);
-
- basic_ofstream(int fd, char_type *buf, int len);
-
- virtual ~basic_ofstream();
-
- basic_filebuf<charT, traits> *rdbuf() const;
-
- bool is_open();
-
-
- void open(const char *s, ios_base::openmode mode =
- ios_base::out,
- long protection = 0666 );
-
- void close();
-
- protected:
-
- private:
-
- basic_filebuf<charT, traits> fb_;
- };
-
- /*
- *
- * Class basic_fstream
- *
- */
-
- template<class charT, class traits>
- class _RWSTDExportTemplate basic_fstream : public basic_iostream<charT, traits> {
-
- public:
-
- typedef basic_ios<charT, traits> ios_type;
-
- typedef traits traits_type;
- typedef charT char_type;
- typedef _TYPENAME traits::int_type int_type;
- typedef _TYPENAME traits::pos_type pos_type;
- typedef _TYPENAME traits::off_type off_type;
-
-
- basic_fstream();
-
- _EXPLICIT basic_fstream(const char *s, ios_base::openmode mode =
- ios_base::in | ios_base::out,
- long protection= 0666 );
-
- _EXPLICIT basic_fstream(int fd);
-
- basic_fstream(int fd, char_type *buf, int len);
-
- virtual ~basic_fstream();
-
- basic_filebuf<charT, traits> *rdbuf() const;
-
- bool is_open();
-
- void open(const char *s, ios_base::openmode mode =
- ios_base::in | ios_base::out,
- long protection = 0666 );
-
- void close();
-
- protected:
-
- private:
-
- basic_filebuf<charT, traits> fb_;
-
- };
-
-
- #ifndef _RWSTD_NO_COMPLEX_DEFAULT_TEMPLATES
- typedef basic_filebuf<char> filebuf;
- #else
- typedef basic_filebuf<char, char_traits<char> > filebuf;
- #endif
- #ifndef _RWSTD_NO_WIDE_CHAR
- #ifndef _RWSTD_NO_COMPLEX_DEFAULT_TEMPLATES
- typedef basic_filebuf<wchar_t> wfilebuf;
- #else
- typedef basic_filebuf<wchar_t, char_traits<wchar_t> > wfilebuf;
- #endif
- #endif
-
-
- #ifndef _RWSTD_NO_COMPLEX_DEFAULT_TEMPLATES
- typedef basic_ifstream<char> ifstream;
- #else
- typedef basic_ifstream<char, char_traits<char> > ifstream;
- #endif
-
- #ifndef _RWSTD_NO_WIDE_CHAR
- #ifndef _RWSTD_NO_COMPLEX_DEFAULT_TEMPLATES
- typedef basic_ifstream<wchar_t> wifstream;
- #else
- typedef basic_ifstream<wchar_t, char_traits<wchar_t> > wifstream;
- #endif
- #endif
-
-
- #ifndef _RWSTD_NO_COMPLEX_DEFAULT_TEMPLATES
- typedef basic_ofstream<char> ofstream;
- #else
- typedef basic_ofstream<char, char_traits<char> > ofstream;
- #endif
- #ifndef _RWSTD_NO_WIDE_CHAR
- #ifndef _RWSTD_NO_COMPLEX_DEFAULT_TEMPLATES
- typedef basic_ofstream<wchar_t> wofstream;
- #else
- typedef basic_ofstream<wchar_t, char_traits<wchar_t> > wofstream;
- #endif
- #endif
-
- #ifndef _RWSTD_NO_DEFAULT_TEMPLATES
- typedef basic_fstream<char> fstream;
- #else
- typedef basic_fstream<char, char_traits<char> > fstream;
- #endif
-
- #ifndef _RWSTD_NO_WIDE_CHAR
- #ifndef _RWSTD_NO_DEFAULT_TEMPLATES
- typedef basic_fstream<wchar_t> wfstream;
- #else
- typedef basic_fstream<wchar_t, char_traits<wchar_t> > wfstream;
- #endif
- #endif
-
- #ifndef _RWSTD_NO_NAMESPACE
- }
- #endif
-
- #ifdef _RWSTD_COMPILE_INSTANTIATE
- #include <fstream.cc>
- #endif
- #ifndef __USE_STD_NAMES__
- using namespace std;
- #endif
-
- #pragma option pop
- #endif /* __FSTREAM__ */
-